home *** CD-ROM | disk | FTP | other *** search
-
-
- File: JDBTREE
- Author: Jeffrey L. Darling
- Date established: 02-17-1991
- Latest release: 06-04-1991
- Current Version: 1.20
- =======================================================================
-
-
-
- CONTENTS
-
- I. Archive file list
- II. System requirements
- III. Purpose
- IV. Brief Description
- V. Detailed Description
- VI. Version Information
- VII. Authors Contact information
-
-
-
-
-
-
-
- I. Archive file list:
- -----------------------------------------------------------------------
-
- JDBTREE DOC 8609 6-07-91 12:38a This Documentation
- JDBTREE EXE 7248 6-01-91 4:35a Executable
- WORDS DAT 84 6-01-91 4:35a Data file - JDBTREE.EXE
- JDBTREE PAS 3723 6-01-91 4:35a Pascal Program
- CUST EXE 6736 6-07-91 12:35p Executable
- CUST DOC 3136 6-07-91 12:35p Cust Documentation
- CUST DAT 65 6-07-91 12:35p Data file - CUST.EXE
- CUST PAS 3463 6-07-91 12:35p Pascal Program
-
- If any of these files are not as shown above, Please contact the author.
-
-
-
-
-
-
-
-
-
-
- II. System requirements:
- -----------------------------------------------------------------------
- IBM PC,XT,AT,PS/2 or compatible.
- 256K RAM
- Turbo Pascal 5.5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- III. Purpose:
- -----------------------------------------------------------------------
-
- This Turbo Pascal program demonstrates how to use Binary trees
-
- A binary tree is a data structure. It is a very useful structure to
- learn. If you are in a Computer Science program, I am sure this
- will be helpful to you. In this package I will attempt to explain
- this mysterious data structure.
-
- If you REALLY want to understand this data structure, then follow
- the instructions below.
-
- 1. Load JDBTREE.PAS into TURBO PASCAL using INTEGRATED ENVIRONMENT.
-
- 2. Use the "Watch Variable" capabilities on the following variables
- in this format:
-
- Ancestor
- Root
- Ancestor^,R
- Root^,R
- NextWord
-
- Watch them! keep track of what is happening with each and
- every variable. ESPECIALLY the RIGHT and LEFT variables.
- You will see that the RIGHT and LEFT occur next to Ancestor^,R
- and Root^,R. The R is a Debug expression format character for
- displaying the field names of a record.
-
- 3. Use the "Trace" capabilities! In conjunction with the
- "Watch Variable" option. You will see how it really works.
- Pressing F7 will execute One line at a time.
- (Step Through the program)
-
-
- 4. Change the WORDS.DAT file. Put in values of your own. Then
- try to predict what will happen in each and every variable.
- This will force you to think about HOW it works. Think about
- every tiny detail. Be creative, Notice things that are side
- effects and how you can use these side effects in programs that
- YOU write.
-
- Believe me, just try it. I think you will be surprised with
- the results. Especially if you are a novice programmer.
-
-
-
- IV. Brief Description:
- -----------------------------------------------------------------------
-
- In this program, each node on the tree contains a name and an
- integer number telling how many times that name has been read
- in from the WORDS.DAT text file. Also notice that the names have
- been sorted as well! This is a side affect of binary trees.
-
- Each time a NEW name is read in, then it is put in the proper
- place in the tree. If the name is NOT NEW then it's counter is
- accumulated.
-
-
-
-
-
-
-
-
-
-
-
-
- V. Detailed Description:
- -----------------------------------------------------------------------
-
- Every binary tree must contain at least four elements.
-
- One: the info you wish to store.
- Two: a pointer to the LEFT NODE.
- Three: a pointer to the RIGHT NODE.
- Four: a record to point.
-
- Note: NODES are sometimes referred to as LINKS. Do not confuse binary
- trees with linked lists, because they are very different.
-
-
-
- type String_10 = String[10];
- Branch=^Treenode;
- Treenode = record
- Word : String_10;
- count : integer;
- Left,Right : Branch
- end; {Tree}
-
-
- Above is the type declaration for the binary tree.
-
-
- Variable Eplanation
- -------- --------------------------
- String_10 Declares a string type with a length of 10
- The input record contains a list of names.
- Each unique name is stored in a variable
- called Word.
-
- Branch Pointer to Treenode
- This pointer type is VERY important. This will
- be the type of pointer of the Left and Right
- pointers to the Trees NODES. Branch must be
- declared as a pointer of the record that the
- node is declared as. In this case Treenode.
-
- Treenode This record contains the four essential elements
- of the tree structure.
-
- Word Contains string of 10 characters.
- This is information that we wish to store.
-
- Count Contains integer with a count of how many
- times the Word occurs in the input file.
- This is also valuable information we wish to
- store.
-
- Left Pointer to Left Treenode
-
- Right Pointer to Right Treenode
-
-
-
-
- Another important element of the tree structure is the ROOT.
-
-
- Root
- ┌────┬─────┬────┬─────┐
- │Word│count│Left│Right│
- └────┴─────┴────┴─────┘
- Jeff 2
- ┌──────┐ │ │
- └─────────────────────────────┘ │
- ┌────┬─────┬────┬─────┐ │ ┌────┬─────┬────┬─────┐
- │Word│count│Left│Right│ └ │Word│count│Left│Right│
- └────┴─────┴────┴─────┘ └────┴─────┴────┴─────┘
- Debbie 1 nil nil Kim 10 nil
- │
- ┌─────────────────────────────────┘
-
- ┌────┬─────┬────┬─────┐
- │Word│count│Left│Right│
- └────┴─────┴────┴─────┘
- Laura 1 nil │
- │
- │
- │ ┌────┬─────┬────┬─────┐
- └ │Word│count│Left│Right│
- └────┴─────┴────┴─────┘
- Steve 1 nil nil
-
-
-
-
-
-
-
- VI. Version Information
- -----------------------------------------------------------------------
-
- 1.00 Initial release 03-17-1991
-
- No documentation. Originally a simple solution to a problem
- stated in a message base of a bulletin board. I wish I could
- remember the fellows name so I can give him credit for
- motivating me to do this.
-
- 1.10 Trivial update 04-09-1991
-
- Added file handling so data was supplied to give users a good
- pool of data.
-
-
- 1.20 Added some documentation 06-04-1991
-
- Added all of the JDBTREE.DOC file.
- Includes some in code documentation.
-
- 1.30 Added CUST program 6-07-1991
-
- Added CUST.PAS, CUST.DOC. CUST.DAT and CUST.EXE
- This program uses the same code as JDBTREE to implement
- the use of files with the seek procedure.
-
-
-
-
-
-
- VII. Authors Contact information
- -----------------------------------------------------------------------
-
- If you have any suggestions, questions or comments feel free
- to contact me.
-
- U.S. MAIL: Jeff Darling
- P.O. Box 154
- Barrington Il, 60011
-
- Email: Jeff Darling
- Polysyncronism BBS
- (708) 358-5104
- 24 hours 300/1200/2400 8N1
-
- CompuServe: Jeff Darling 72010,22
-
-
-
-